#include <bits/stdc++.h>
using namespace std;

// #define ONLINE_JUDGE

#ifndef ONLINE_JUDGE
#define dbg(x...)                             \
	{                                         \
		cerr << "\033[32;1m" << #x << " -> "; \
		err(x);                               \
	}
void err()
{
	cerr << "\033[39;0m" << endl;
}
template <typename T, typename... A>
void err(T a, A... x)
{
	cerr << a << ' ';
	err(x...);
}
#else
#define dbg(...)
#endif

typedef long long LL;

const int N = 1e6 + 50;

struct Assembly
{
    int c, m, id;
};

struct P
{
    int x, y;
    P(int x = 0, int y = 0)
        : x(x), y(y)
    {
    }

    P operator-(const P &other) const
    {
        return P(x - other.x, y - other.y);
    }

    LL operator*(const P &other) const
    {
        return (LL)x * other.y - (LL)y * other.x;
    }

    bool operator<(const P &other) const
    {
        return ((LL)x * other.y - (LL)y * other.x) > 0;
    }
};

int n, M;

vector<Assembly> a[N];
vector<P> b[N];

P dat[N];
int m;

LL cp(int x, int y, int x2, int y2)
{
    return (LL)x * y2 - (LL)y * x2;
}

vector<Assembly> reduceConv(const vector<Assembly> &a)
{
    int n = a.size();
    static Assembly st[N];
    static int top = 0;
    st[top++] = a[0];
    for (int i = 1; i < n; ++i)
    {
        if (a[i].c >= a[i - 1].c)
            break;
        while (top > 1 && cp(st[top - 1].c - st[top - 2].c, st[top - 1].m - st[top - 2].m, a[i].c - st[top - 2].c, a[i].m - st[top - 2].m) <= 0)
            --top;
        st[top++] = a[i];
    }
    vector<Assembly> res;
    res.resize(top);
    for (int i = 0; i < top; ++i)
        res[i] = st[i];
    return res;
}

Assembly ans[N][2];
int A[N], B[N];
int siz[N];

bool check(int mid)
{
    P cur = dat[mid];
    int curM = 0;

    static int sp[N], sx[N], sid[N];
    int scnt = 0;

    for (int i = 0; i < n; ++i)
    {
        auto it = lower_bound(b[i].begin(), b[i].end(), cur);
        int id = it - b[i].begin();

        if (it == b[i].end())
            --id;
        curM += a[i][id].m;
        if (curM > M)
            return false;

        siz[i] = 0;
        if (it == b[i].end() || memcmp(&(*it), &b[i][id], sizeof(b[i][id])) != 0)
            ans[i][siz[i]++] = a[i][id];
        else
        {
            sp[scnt] = i;  
            sid[scnt] = id;
            sx[scnt++] = b[i][id].x; 
        }
    }
    int i = 0;
    for (i=0; i<scnt && curM + sx[i] <= M; ++i)
    {
        int id = sp[i];
        ans[id][0] = a[id][sid[id]+1];
        curM += sx[i];
    }
    if (i < scnt)
    {
        int id = sp[i];
        ans[id][siz[id]++] = a[id][sid[id]+1];
        A[id] = M - curM; B[id] = b[id][sid[id]].x;
    }
    return true;
}

int main(int argc, char const *argv[])
{
    scanf("%d%d", &n, &M);
    m = 0;
    for (int i = 0; i < n; ++i)
    {
        int k;
        scanf("%d", &k);
        a[i].resize(k);
        for (int j = 0; j < k; ++j)
        {
            scanf("%d%d", &a[i][j].m, &a[i][j].c);
            a[i][j].id = j;
        }
        sort(a[i].begin(), a[i].end(), [](const Assembly &a, const Assembly &b) {
            return a.m != b.m ? a.m < b.m : a.c < b.c;
        });

        a[i] = reduceConv(a[i]);
        k = a[i].size();
        b[i].resize(k - 1);
        for (int j = 1; j < k; ++j)
        {
            b[i][j - 1] = P(a[i][j].m - a[i][j - 1].m, a[i][j].c - a[i][j - 1].c);
            dat[m++] = b[i][j - 1];
        }
    }

    sort(dat, dat + m);

    int l = 0, r = m;
    check(0);
    while (l < r - 1)
    {
        int mid = (l + r) >> 1;
        dbg(l, r, mid);
        if (check(mid))
            l = mid;
        else
            r = mid;
    }
    


    long double cost = 0;
    for (int i=0; i<n; ++i)
    {
        if (siz[i] == 1)
            cost += ans[i][0].c;
        else
        {
            long double alpha = (long double)A[i] / B[i];
            cost += alpha * ans[i][0].c + (1.0 - alpha) * ans[i][1].c;
        }
    }

    printf("%.13Lf\n", cost);
    for (int i=0; i<n; ++i)
    {
        if (siz[i] == 1)
            printf("1 %d\n", ans[i][0].id);
        else
        {
            printf("2 %d %d %d %d\n", ans[i][0].id, ans[i][1].id, A[i], B[i]);
        }
    }
    
    return 0;
}